﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EHTSaleManager.Code.BLL;

namespace EHTSaleManager.UIAdmin
{
    public partial class AdminBanners : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadQuangCao();
            }
        }
        public void LoadQuangCao()
        { 
            this.rpBanners.DataSource=QuangCaoProvider.GetQuangCao();
            this.rpBanners.DataBind();
        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Response.Redirect("AdminBannerIU.aspx");
        }

        protected void rpBanners_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            String cmdName = e.CommandName;
            Int32 QuangCaoID = Int32.Parse(e.CommandArgument.ToString());
            if (cmdName == "delete1")
            {
                QuangCaoProvider.GetDeleteQuangCao(QuangCaoID);
                LoadQuangCao();
            }
        }
    }
}